package models

import (
	"time"
	"github.com/astaxie/beego/orm"
)

type Goods struct {
	Id           int
	Title        string        `ht:"list;search;name(标题)"`
	Author       string                `ht:"list;name(发布者)"`
	Price        float64                `ht:"list;name(价格)"`
	TotalCount   int                `ht:"name(总数)"`
	RestCount    int                `ht:"name(库存数)"`
	EditTime     time.Time        `ht:"list;name(编辑时间);defaultvalue(time.Now())"`
	CreateTime   time.Time                `ht:"hide;defaultvalue(time.Now())"`
	Introduction string                `ht:"name(简介)"`
	ListPicPath  string 	`ht:"name(列表页图片);type(pic)"`
	Content      string `orm:"type(text)" ht:"type(mutitext);name(内容)"`
	Type         int `ht:"subclass([{\"Num\":0,\"Name\":\"文化用品\"},{\"Num\":1,\"Name\":\"图书\"}]);name(文章类型)"`
	CommentOrNot int `ht:"name(是否可评论);enum([{\"Key\":\"0\",\"Value\":\"不可评论\"},{\"Key\":\"1\",\"Value\":\"可评论\"}])"`
	BuyOrNot     int `ht:"name(是否可购买);enum([{\"Key\":\"0\",\"Value\":\"不可购买\"},{\"Key\":\"1\",\"Value\":\"可购买\"}])"`
	Recommend    int `ht:"name(是否是精品);enum([{\"Key\":\"0\",\"Value\":\"不是精品\"},{\"Key\":\"1\",\"Value\":\"精品\"},{\"Key\":\"1\",\"Value\":\"精品置顶\"}])"`
	Status       int `ht:"status([{\"Num\":0,\"Name\":\"未审核\"},{\"Num\":1,\"Name\":\"删除\"},{\"Num\":2,\"Name\":\"发布\"}]);name(状态)"` //0:init;1:delete;2:publish
	StartCount   int        `ht:"list;name(点赞)"`
	BrowseCount  int        `ht:"list;name(浏览人数)"`
	WatchCount   int        `ht:"list;name(浏览人数)"`
	UserId       int        `ht:"hide;name(发表者Id)"`
	CityId       int        `ht:"hide;name(所在地Id)"`
}


//type
//0 文化用品
//1 图书
func init() {
	orm.RegisterModel(new(Goods))
}
func (*Goods)TableName() string {
	return "goods"
}

func (*Goods) FN_Id() string {
	return "Id"
}
func (*Goods) FN_Title() string {
	return "Title"
}
func (*Goods) FN_Author() string {
	return "Author"
}
func (*Goods) FN_Price() string {
	return "Price"
}
func (*Goods) FN_TotalCount() string {
	return "TotalCount"
}
func (*Goods) FN_RestCount() string {
	return "RestCount"
}
func (*Goods) FN_EditTime() string {
	return "EditTime"
}
func (*Goods) FN_CreateTime() string {
	return "CreateTime"
}
func (*Goods) FN_Introduction() string {
	return "Introduction"
}
func (*Goods) FN_Content() string {
	return "Content"
}
func (*Goods) FN_Type() string {
	return "Type"
}
func (*Goods) FN_CommentOrNot() string {
	return "CommentOrNot"
}
func (*Goods) FN_BuyOrNot() string {
	return "BuyOrNot"
}
func (*Goods) FN_Recommend() string {
	return "Recommend"
}
func (*Goods) FN_Status() string {
	return "Status"
}
func (*Goods) FN_StartCount() string {
	return "StartCount"
}
func (*Goods) FN_BrowseCount() string {
	return "BrowseCount"
}
func (*Goods) FN_WatchCount() string {
	return "WatchCount"
}
func (*Goods) FN_UserId() string {
	return "UserId"
}
func (*Goods) FN_CityId() string {
	return "CityId"
}